using System;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.Events;

public class MonoManager : SingletonMonoBase<MonoManager>
{
    private event UnityAction UpdateEvent;
    
    private event UnityAction LateUpdateEvent;
    
    private event UnityAction FixedUpdateEvent;

    public void AddUpdateEvent(UnityAction action)
    {
        UpdateEvent += action;
    }

    public void AddLateUpdateEvent(UnityAction action)
    {
        LateUpdateEvent += action;
    }

    public void AddFixedUpdateEvent(UnityAction action)
    {
        FixedUpdateEvent += action;
    }
    
    public void RemoveUpdateEvent(UnityAction action)
    {
        UpdateEvent -= action;
    }

    public void RemoveLateUpdateEvent(UnityAction action)
    {
        LateUpdateEvent -= action;
    }

    public void RemoveFixedUpdateEvent(UnityAction action)
    {
        FixedUpdateEvent -= action;
    }
    
    private void Update()
    {
        UpdateEvent?.Invoke();
    }

    private void LateUpdate()
    {
        LateUpdateEvent?.Invoke();
    }

    private void FixedUpdate()
    {
        FixedUpdateEvent?.Invoke();
    }
}
